package com.zlx.guguanjia.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zlx.guguanjia.entity.SysOffice;
import com.zlx.guguanjia.mapper.SysOfficeMapper;
import com.zlx.guguanjia.service.SysOfficeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.util.List;
import java.util.Map;

/**
 * @Author 周罗校
 * @Description
 * @ClassName SysOfficeServiceImpl
 * @date 2020.10.27 16:52:32
 * 该版权归周罗校所有，最终解释权以官方为准
 */

@Service
@Transactional
public class SysOfficeServiceImpl extends BaseServiceImpl<SysOffice,Long> implements SysOfficeService {

    @Autowired
    private SysOfficeMapper mapper;

    //开启redis缓存
    @Override
    @Cacheable(cacheNames = "SysOffice",key = "'com.zlx.guguanjia.service.impl.SysOfficeServiceImpl:select:'+#o.getDelFlag()")
    public List select(SysOffice o) {
        return super.select(o);
    }


    @Override
    public PageInfo ListAll(int start, int pageSize, Map<String, Object> condition) {
        PageHelper.startPage(start,pageSize);
        return new PageInfo(mapper.selectPage(condition));
    }

    @Override
    public List<SysOffice> selectByRid(long rid) {
        return mapper.selectByRid(rid);
    }
}
